/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pt.our.angemc.datatypes;

import java.util.ArrayList;

/**
 *
 * @author piskeiro
 */
public class Production {
    private ArrayList<Symbol> symbols;

    public Production(ArrayList<Symbol> symbols) {
        this.symbols = symbols;
    }

    public ArrayList<Symbol> getSymbols() {
        return symbols;
    }

    public void setSymbols(ArrayList<Symbol> symbols) {
        this.symbols = symbols;
    }

    public void addSymbol(Symbol symbol){
        symbols.add(symbol);
    }

    @Override
    public Production clone(){
        ArrayList<Symbol> newSymbols = new ArrayList<Symbol>();
        for(Symbol symbol : symbols){
            newSymbols.add(symbol.clone());
        }
        Production production = new Production(newSymbols);
        return production;
    }

    @Override
    public String toString(){
        StringBuffer sb = new StringBuffer();
        for(Symbol symbol : symbols){
            sb.append(symbol.toString()+" ");
        }
        return sb.toString().trim();
    }

}
